/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package PackageMaker.Config;

import java.io.File;

/**
 *
 * @author wcss
 */
public class ConfigModel 
{
    public static ConfigModel load(String path) throws Exception {
        if (new File(path).exists()) {
            return (ConfigModel) ObjectToXMLUtil.loadObjectFromXml(path);
        } else {
            return null;
        }
    }

    public static void save(ConfigModel entry, String path) throws Exception {
        ObjectToXMLUtil.saveObjectToXml(entry, path);
    }
    
    public ConfigModel()
    {
        this.languageName = "english";
        this.compileType = "system";
        this.workDir = "/opt/debBuilderApp";
        this.compileCmd = "dpkg -b " + "(source)" + " " + "(dest)" + " " + "(output)" + " " + "(pkgtype)"  + " " + "(pkgname)";
        this.hideCompileType = "ypk";
        this.defaultNewProjectCompileType = 0;
        this.editScriptCmd = "gedit (file)";
    }
    public ConfigModel(String language,String type,String dir,String cmd,String hide,int newcompileindex,String editscript)
    {
        this.languageName = language;
        this.compileType = type;
        this.workDir = dir;
        this.compileCmd = cmd;
        this.hideCompileType = hide;
        this.defaultNewProjectCompileType = newcompileindex;
        this.editScriptCmd = editscript;
    }
    
    public String languageName = "";
    public String compileType = "";
    public String workDir = "";
    public String compileCmd = "";
    public String hideCompileType = "";
    public int defaultNewProjectCompileType = 0;
    public String editScriptCmd = "";
}
